package com.gmcc.tripleplay.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.sara.util.loader.CacheDataBase.CacheList_DataSheet;

public class DatabaseHelper extends SQLiteOpenHelper {

	private static final String DATABASE_NAME = "tripleplay";
	private static final int DATABASE_VERSION = 1;

	public static final String DATABASE_TABLE_CACHELIST = "urlcache";

	private static final String DATABASE_CREATE_CACHELIST = "CREATE TABLE  IF NOT EXISTS "
			+ DATABASE_TABLE_CACHELIST
			+ " "
			+ "("
			+ CacheList_DataSheet.mUrl
			+ " TEXT,"
			+ CacheList_DataSheet.mFileName
			+ " TEXT,"
			+ CacheList_DataSheet.mExpiredTime + " TEXT);";

	public DatabaseHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(DATABASE_CREATE_CACHELIST);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE_CACHELIST);
		onCreate(db);
	}

}